class Building:
    def __init__(self, buildingId: str, buildingName: str, location: str):
        self.buildingId = buildingId
        self.buildingName = buildingName
        self.location = location
    
    def getBuildingInfo(self) -> str:
        return f"Building ID: {self.buildingId}, Name: {self.buildingName}, Location: {self.location}"


class Course:
    def __init__(self, courseId: str, courseName: str, credits: int):
        self.courseId = courseId
        self.courseName = courseName
        self.credits = credits
    
    def getCourseInfo(self) -> str:
        return f"Course ID: {self.courseId}, Name: {self.courseName}, Credits: {self.credits}"


class College:
    def __init__(self, name: str, address: str):
        self.name = name
        self.address = address
        self.buildings = []  # 聚合关系：学院包含建筑
        self.courses = []    # 组合关系：学院由课程组成
    
    def addBuilding(self, building: Building) -> None:
        """添加建筑到学院（聚合关系）"""
        if building not in self.buildings:
            self.buildings.append(building)
    
    def removeBuilding(self, building: Building) -> None:
        """从学院移除建筑"""
        if building in self.buildings:
            self.buildings.remove(building)
    
    def addCourse(self, course: Course) -> None:
        """添加课程到学院（组合关系）"""
        if course not in self.courses:
            self.courses.append(course)
    
    def removeCourse(self, course: Course) -> None:
        """从学院移除课程"""
        if course in self.courses:
            self.courses.remove(course)


# 约束条件实现：Course一定在某个Building中进行
def validate_course_location(course: Course, building: Building) -> bool:
    """
    验证课程是否在指定建筑中进行
    这是对图中约束条件 {constraint}Course一定在某个Building中进行 的实现
    """
    return building is not None
